package com.bwie.controller;

import com.bwie.domain.Book;
import com.bwie.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: lrz
 * @Date: 2024/11/20 08:39
 * @Description:
 **/
@RestController
@RequestMapping("/book")
public class BookController {

    @Autowired
    BookService bookService;

    @PostMapping("/list")
    public List<Book> list(){
        return bookService.list();
    }

    @PostMapping("/add")
    public int add(Book book){
        return bookService.add(book);
    }

    @PostMapping("/update")
    public int update(Book book){
        return bookService.update(book);
    }

    @PostMapping("/delete")
    public int delete(Integer id){
        return bookService.delete(id);
    }

}
